interface Named {
    String getName();
}
// 创建姓名统计器类 NameCounter
class NameCounter {
    public void countAndPrintName(Named named) {
        String name = named.getName();
        int charCount = name.length();
        System.out.printf("名字是：[%s],共有%d个字符。\n", name, charCount);
    }

    public static void main(String[] args) {
        NameCounter counter = new NameCounter();

        // 使用 Lambda 表达式创建 Named 实例并调用四次
        counter.countAndPrintName(() -> "张三");
        counter.countAndPrintName(() -> "李四");
        counter.countAndPrintName(() -> "Java");
        counter.countAndPrintName(() -> "编程");
    }
}